#pragma once
#include "Day.h"

class Calender{

public:
	Calender(void);
	~Calender(void);
	Calender(const Calender& calender);
	const Calender& operator =(const Calender& calender);

	bool init();

	void cleanCalender();

	// set a new appointment in the calender
	// return true iff the operation passed
	bool addMeeting(int day, float startTime, float endTime, string& subject);

	// remove appointment from the calender
	// return true iff the operation passed
	bool removeMeeting(const int day,const float startTime);

	// get appointmet by start time and day
	const Meeting* getMeetingByStartTime(int day, float startTime) const;

	// set the meeting
	// return true iff the operation passed
	virtual bool copyMeeting(const Meeting& m, int newDay, float newTime);

	// return a string representation of the calender
	ostream& Calender::writeToStream(ostream & str) const;

protected:
	Day* days[7];

	//helper functions
	inline bool legalDay(const int d) const;
	inline bool legalTimeFormat(const float t) const;


private:
	void Calender::freeCalenderMem();
};

